//
//  BaseNavigationViewController.m
//  xmppones
//
//  Created by 李立达 on 2017/2/17.
//  Copyright © 2017年 李立达. All rights reserved.
//

#import "BaseNavigationViewController.h"

@interface BaseNavigationViewController ()
@property (nonatomic,strong)UIButton *leftButton;
@property (nonatomic,strong)UIButton *rightButton;
@property (nonatomic,strong)UILabel  *titleLable;
@end

@implementation BaseNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
     self.navigationBar.hidden = YES;
    self.navBarView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64)];
    self.navBarView.backgroundColor = [UIColor grayColor];
    [self.view addSubview:self.navBarView];
}



- (void)needResetNavigationBarLeftButton
{
    UIButton *button = [self.navdelegate returnLeftButton];
    button.bounds = CGRectMake(0, 0, 40, 40);
    button.layer.allowsEdgeAntialiasing = YES;
    button.layer.cornerRadius = button.height / 2;
    button.clipsToBounds = YES;
    button.layer.masksToBounds = YES;
    button.center = CGPointMake(20 + button.width/2, NavgionbarHeight/2);
    [self.navBarView addSubview:button];
    [_leftButton removeFromSuperview];
    _leftButton = button;
}

- (void)needResetNavigationBarMiddletitle
{
    UILabel *label = [self.navdelegate returntitle];
    [label sizeToFit];
    label.center = CGPointMake(KDeviceWith/2, NavgionbarHeight/2);
    [self.navBarView addSubview:label];
    [self.titleLable removeFromSuperview];
    _titleLable = label;
}

- (void)needResetNavigationBarRightButton
{
    UIButton *button = [self.navdelegate returnRightButton];
    button.bounds = CGRectMake(0, 0, 40, 40);
    button.layer.allowsEdgeAntialiasing = YES;
    button.layer.cornerRadius = button.height / 2;
    button.clipsToBounds = YES;
    button.layer.masksToBounds = YES;
    button.center = CGPointMake(KDeviceWith- 20 - button.width/2, NavgionbarHeight/2);
    [self.navBarView addSubview:button];
    [_rightButton removeFromSuperview];
    _rightButton = button;
}

@end
